package com.yds.workmanager.worker

import android.content.Context
import android.util.Log
import androidx.work.Worker
import androidx.work.WorkerParameters
import java.lang.Exception

/**
 * 作者:     YDS
 * 创建时间: 2025/7/11 14:53
 * 页面描述: 日志上传
 */
class LogUploadWorker(context: Context, params: WorkerParameters) : Worker(context, params) {
    override fun doWork(): Result {
        return try {
            Log.i("YDSimon", "处理日志上传操作...")
            Result.success()
        } catch (e: Exception) {
            if (runAttemptCount<3){
                Log.i("YDSimon", "处理日志上传操作->重试")
                Result.retry()
            }else{
                Log.i("YDSimon", "处理日志上传操作->Exception $e")
                Result.failure()
            }
        }

    }
}